"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolvePath = exports.isCss = exports.resolveCompiler = exports.isDir = void 0;
function isDir(str) {
    // TODO: 检测str 是否是路径
    return str[str.length - 1] === '/';
}
exports.isDir = isDir;
function resolveCompiler(root) {
    // TODO: if user install some vue compiler, use user's first
    if (root) {
        return require('vue-template-compiler');
    }
    return require('vue-template-compiler');
}
exports.resolveCompiler = resolveCompiler;
exports.isCss = /\.(css|less|sass|scss)$/;
let configAlias = Object.create(null);
// to resolve path for some import module.
// such as @/utils/index.js
function resolvePath(pathString, { alias = {} }) {
    if (Object.keys(configAlias).length === 0) {
        configAlias = alias;
    }
    let s = pathString.slice();
    for (const key in configAlias) {
        if (s.startsWith(key)) {
            s = s.replace(key, configAlias[key]);
        }
    }
    return s;
}
exports.resolvePath = resolvePath;
